package com.niu.crm.service;

import java.util.List;

import com.niu.crm.model.Dict;
import com.niu.crm.model.User;
import com.alibaba.fastjson.JSONArray;

public interface DictService {

	void refrechCache();
	
	Dict load(Long id);
	
	Dict loadByCode(String code);
	
    void delete(User user, Long id);

    List<Dict> loadChildren(Long parentId);
    
    List<Dict> loadChildren(String parentCode);
    
    List<Dict> selectByName(String codePrefix, String dictName);
    
    JSONArray loadJSONTree(Long parentId);
    
    JSONArray getJSONTree(Long parentId);
    
    /**
     * 判断 ancestorDict 是否是dict的上级
     * @param ancestorDict
     * @param dict
     * @return
     */
    boolean isAncestorDict(Dict ancestorDict, Dict dict);
    
}
